//
// Created by ziya on 23-6-29.
//
#include "tty.h"
#include "kernel.h"
#include "mm.h"
#include "idt.h"
#include "io.h"
#include "time.h"
#include "task.h"

long startup_time;

void* task_fun(void* arg) {
    for (int i = 0; i < 10000; ++i) {
        printk("%d\n", i);
    }

    return NULL;
}

void kernel64_main(void) {
    console_init();
    phy_memory_init();
    idt_init();
    time_init();

    printk("system start at:%ld", startup_time);

    task_create(task_fun, "t1");
    task_create(task_fun, "t2");

    asm volatile("sti;");

    while (true) {
//        printk("kernel64_main\n");
        asm volatile("hlt;");
    }
}